#include "PlayerStateLand.h"
#include "Player.h"

PlayerStateLand::PlayerStateLand(Player* player, sf::Sound* landSFX) :
PlayerState(player),
_landSFX(landSFX)
{}


PlayerStateLand::~PlayerStateLand(void){}

void PlayerStateLand::activate()
{
	_player->getAnimationMgr().setAnimation("land");
	_landSFX->play();
}

void PlayerStateLand::deactivate()
{

}

int PlayerStateLand::update()
{
	if (_player->damageReceived())
		return PSRV_TAKE_DAMAGE;
	_player->applyVelocity();
	if (_player->getMovementStateX() != MSX_NONE)
		return PSRV_MOVING_GROUND;
	else if (_player->getAnimationMgr().getCurrentID() == "land")
	{
		if (_player->getAnimationMgr().isDone())
			return PSRV_IDLE;
	}
	return PSRV_NOTHING;
}